#include <iostream>

using namespace std;

int main()
{
	int a, b;
	
	int max = 0, j = 0, ret = 0;
	for(int i = 0; i < 7; i++)
	{
		cin >> a >> b;
		j++;
		if (a + b > 8 && a+b > max)
		{
			max = a + b;
			ret = j;
		}
	}

	cout << ret << endl;

	return 0;
}